//
// Created by denglibin on 2021/4/23.
// 打印菱形
//   *
//  * *
// *   *
//  * *
//   * 
#include <stdio.h>
int main()
{
    int a, b, c, d;
    printf("input a num:");
    scanf("%d", &b);
    for (a = 1; a <= b; a++)
    { //层数
        for (d = 1; d <= 2 * b; d++)
        {
            if (a == 1)
            {
                if (d != b)
                {
                    printf(" ");
                }
                else
                {
                    printf("*");
                }
                continue;
            }
            if (d == b - (a - 1) || d == b + (a - 1))
            {
                printf("*");
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }

    int b2 = b - 1;
    for (a = 1; a <= b2; a++)
    { //层数
        for (d = 1; d <= 2 * b2; d++)
        {
            if (a == b2)
            {
                if (d != b2 + 1)
                {
                    printf(" ");
                }
                else
                {
                    printf("*");
                }
                continue;
            }
            if (d == a + 1 || d == 2 * b - a - 1)
            {
                printf("*");
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }
}
